package cn.itsource.ymcc.web.controller;


import cn.itsource.result.JSONResult;
import cn.itsource.ymcc.dto.SmsCodeDTO;
import cn.itsource.ymcc.service.IVerifycodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * @Author: Eric
 * @CreateTime: 2022-08-06  10:21
 * @Description:
 */

@RestController
@RequestMapping("/verifycode")
public class VerifyCodeController {


    @Autowired
    private IVerifycodeService verifycodeService;

    @PostMapping("/sendSmsCode")
    public JSONResult sendSmsCode(@RequestBody @Valid SmsCodeDTO dto){

        return verifycodeService.sendSmsCode(dto);
    }

    @GetMapping("/imageCode/{imageCodeKey}")
    public JSONResult imageCode(@PathVariable("imageCodeKey") String imageCodeKey){
        return verifycodeService.getImageCode(imageCodeKey);

    }
}
